package com.demo;

import java.util.List;

import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.activerecord.dialect.OracleDialect;
import com.jfinal.plugin.druid.DruidPlugin;
import com.ynrcc.model.ComBrch;

public class Test2 {
	/**
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		DruidPlugin dp = new DruidPlugin("jdbc:oracle:thin:@192.168.231.1:1521:xe", "eova", "eova");
		dp.setValidationQuery("select 1 FROM DUAL");   
		ActiveRecordPlugin arp = new ActiveRecordPlugin(dp);
		arp.setDialect(new OracleDialect());
		arp.addMapping("com_brch", ComBrch.class);
		// 与web环境唯一的不同是要手动调用一次相关插件的start()方法
		dp.start();
		arp.start();
		// 通过上面简单的几行代码，即可立即开始使用
		List<ComBrch> brchs = ComBrch.dao.find("select * from com_brch");
		System.out.println(brchs.size());
	}
}
